/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.util.Date;

/**
 *
 * @author Hans
 */
public class OwnedWare {

    private String name;
    private String category;
    private int purchasePrice;
    private int soldPrice;
    private long dateIn;
    private long dateOut;

    public OwnedWare(String name, String category, int purchasePrice, int price, long dateIn) {
        this.name = name;
        this.category = category;
        this.purchasePrice = purchasePrice;
        this.soldPrice = price;
        this.dateIn = dateIn;
        this.dateOut = 0;
    }

    public OwnedWare() {
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPurchasePriceAsString() {
        return String.valueOf(purchasePrice);
    }

    public int getPurchasePrice() {
        return purchasePrice;
    }

    public void setPurchasePrice(int purchasePrice) {
        this.purchasePrice = purchasePrice;
    }

    public int getSoldPrice() {
        return soldPrice;
    }

    public void setSoldPrice(int soldPrice) {
        this.soldPrice = soldPrice;
    }

    public Date getDateIn() {
        return new Date(dateIn);
    }

    public String getDateInAsString() {
        return MyDate.fromLongToString(dateIn);
    }

    public void setDateIn(long dateIn) {
        this.dateIn = dateIn;
    }

    public long getDateOutAsLong() {
        return dateOut;
    }

    public Date getDateOut() {
        Date d = null;
        if (dateOut != 0) {
            d = new Date(dateOut);
        }
        return d;
    }

    public void setDateOut(long dateOut) {
        this.dateOut = dateOut;
    }

    public boolean hasDateOut() {
        return (dateOut != 0);
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

}
